<?php
require_once(DOCTRINE_INCLUDE_STRING);

spl_autoload_register(array('Doctrine', 'autoload'));

Doctrine::loadModels(DIR_GENERATED);
Doctrine::loadModels(DIR_MODELS);
Doctrine::loadModels(DIR_GENERATED_LOGS);
Doctrine::loadModels(DIR_MODELS_LOGS);
//classes auxiliaress
Doctrine::loadModels(DIR_AUXILIAR_CLASSES_FT);

$manager = Doctrine_Manager::getInstance();

$conection_logs = $manager->connection('mysql://'.DB_SERVER_USERNAME.':'.DB_SERVER_PASSWORD.'@'.DB_SERVER.'/'.DB_DATABASE_LOGS, "logs_connection");
$conection_logs->setOption("other", array(PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8", PDO::ATTR_PERSISTENT => false));

$conection = $manager->connection('mysql://'.DB_SERVER_USERNAME.':'.DB_SERVER_PASSWORD.'@'.DB_SERVER.'/'.DB_DATABASE, "base_connection");
$conection->setOption("other", array(PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8", PDO::ATTR_PERSISTENT => false));

$conection->addRecordListener(new LogsRecordListener($manager),"records");
$conection->addListener(new Logs($manager), "transactions");
?>
